Method: Scrivito::AttributeContent#[]

Defined in:
app/cms/scrivito/attribute_content.rb

#[](attribute_name) ⇒ Object

Returns the value of an attribute specified by its name. Passing an invalid key will not raise an error but return nil.

Parameters:

  • attribute_name (Symbol, String)

    the name of the attribute.

Returns:

  • the value of the attribute if it’s defined or nil otherwise.



111
112
113
114
# File 'app/cms/scrivito/attribute_content.rb', line 111

def [](attribute_name)
  attribute_name = attribute_name.to_s
  read_attribute(attribute_name) if has_attribute?(attribute_name)
end